﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public class WeburlTopInfo : DatamodelEntity, IWeburlTop
    {
        #region Fields
        private int _id;
        private string _title;
        private string _icon;
        private string _activeClass;
        private string _identifyCode;
        private string _url;
        private PlatformTypeValue _platformType = PlatformTypeValue.Manager;
        private int _index = 0;
        private bool _showToAll = false;
        #endregion

        #region Properties
        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }
        public string Title
        {
            get { return _title; }
            set
            {
                _title = value;
                RaisePropertyChanged(() => Title);
            }
        }
        public string Icon
        {
            get { return _icon; }
            set
            {
                _icon = value;
                RaisePropertyChanged(() => Icon);
            }
        }
        public string ActiveClass
        {
            get { return _activeClass; }
            set
            {
                _activeClass = value;
                RaisePropertyChanged(() => ActiveClass);
            }
        }
        public string IdentifyCode
        {
            get { return _identifyCode; }
            set
            {
                _identifyCode = value;
                RaisePropertyChanged(() => IdentifyCode);
            }
        }
        public string Url
        {
            get { return _url; }
            set
            {
                _url = value;
                RaisePropertyChanged(() => Url);
            }
        }
        public PlatformTypeValue PlatformType
        {
            get { return _platformType; }
            set
            {
                _platformType = value;
                RaisePropertyChanged(() => PlatformType);
            }
        }
        public int Index
        {
            get { return _index; }
            set
            {
                _index = value;
                RaisePropertyChanged(() => Index);
            }
        }
        public bool ShowToAll
        {
            get { return _showToAll; }
            set
            {
                _showToAll = value;
                RaisePropertyChanged(() => ShowToAll);
            }
        }
        public bool IsCurrent
        {
            get { return !string.IsNullOrEmpty(ActiveClass); }
        }
        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("Title");
            yield return new DatabaseColumn("Icon");
            yield return new DatabaseColumn("ActiveClass");
            yield return new DatabaseColumn("IdentifyCode");
            yield return new DatabaseColumn("Url");
            yield return new DatabaseColumn("PlatformType", false, true);
            yield return new DatabaseColumn("Index");
            yield return new DatabaseColumn("ShowToAll");
        }
    }
}